﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<DHAA.Areas.Administrator.Models.CategoryModels>>" %>
<h3>Categories</h3>
    <table class="list">
        <tr>
            
            <th>
                ID
            </th>
            <th>
                Name
            </th>
            <th>
                Parent
            </th>
            <th>
                Image
            </th>
            <th>
                Description
            </th>
            <th>
                Categories
            </th>
            <th>
                Products
            </th>
            <th>Action</th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            
            <td>
                <%= Html.Encode(item.CategoryID) %>
            </td>
            <td>
                <a href="#<%= Url.Action("List", "Category",new {parentID = item.CategoryID}) %>" class="ajaxLink"><%= Html.Encode(item.CategoryName) %>(<%= item.ChildCount %>)</a>
            </td>
            <td>
                <a href="#<%= Url.Action("List", "Category",new {parentID = item.ParentID}) %>" class="ajaxLink"><%= Html.Encode(item.ParentName) %></a>
            </td>
            <td>
                <a href="<%=ResolveUrl("~/Default/Imagesproduct/")+Html.Encode(item.Image) %>" class="ModalAction"><img src="<%=ResolveUrl("~/Default/Imagesproduct/")+Html.Encode(item.Image) %>" style="height: 50px" alt = "<%= item.Image %>"/></a>
            </td>
            <td>
                <%= Html.Encode(item.Description) %>
            </td>
            <td>
            <a href="#<%= Url.Action("List", "Category",new {parentID = item.CategoryID}) %>" class="ajaxLink">Categories(<%= item.ChildCount %>)</a>
            </td>
            <td>
                 <a href="#<%= Url.Action("List", "Product",new {id = item.CategoryID}) %>" class="ajaxLink">Products(<%= item.ProductCount %>)</a>
            </td>
            <td>
                <%= Html.ActionLink("Edit", "Edit", new { id = item.CategoryID },new { @class = "ModalAction button" })%> |
                <%= Html.ActionLink("Delete", "Delete", new { id = item.CategoryID }, new { @class = "ModalAction button" })%>
            </td>
        </tr>
    
    <% } %>

    </table>
<div class="cleared-top-5"></div>
    <div>
        <%= Html.ActionLink("Create New", "Create", new { parentID = ViewData["ParentID"] }, new { @class = "ModalAction button" })%>
        
    </div>
    <div class="cleared"></div>


